package stage1.test;

public class Person {
    private String name;
    private int age;

    public Person() {
    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        if (age>0 && age<150){
            this.age = age;
        }else {
            System.out.println("年龄不合理");
        }
    }

    public void show(){
        System.out.println("我是"+getName()+",我的年龄是"+getAge());
    }

    public void eat(String food){
        System.out.println(getName()+"说-"+food+"-真好吃");
    }

    public void play(String game){
        System.out.println(getName()+"说，游戏-"+game+"-真好玩");
    }
}
